Get

The Get method retrieves a named value from a registry key without expanding any environment variables. The Get method supports the REG_SZ, REG_EXPAND_SZ, and REG_DWORD named-value data types.

Syntax

Get(FullKeyValueName)

Parameters

FullKeyValueName
A string that specifies the named value. This string should consist of a key name followed by a value name. For example, to specify the value MyValue stored in the key HKLM\Software\MyCompany, you would use the following string:

HKLM\Software\MyCompany\MyValue

The key portion of this parameter can be a key on either a local or a remote machine. Keys on a remote machine are specified by prefixing the key name with the machine name. For example:

\\RemoteMachine\HKLM\Software\MyProg

Return Value

A VARIANT that contains the named value of the specified registry key. Any embedded environment variables will not have been expanded.

Example

The following example retrieves the named values LogFileDirectory and LogFileTruncateSize from the registry key HKLM\System\CurrentControlSet\Services\W3SVC\Parameters\.
<% 
Set Reg = Server.CreateObject("IISSample.Registry")
w3Params = "HKLM\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\"
LogFileDir = Reg.Get(w3Params & "LogFileDirectory")
LogFileDirExpand = Reg.GetExpand(w3Params & "LogFileDirectory")
TruncateSize = Reg.Get(w3Params & "LogFileTruncateSize")
%>
 
Log files are stored in  <% = LogFileDir %> (<% = LogFileDirExpand %>)
and are truncated at <% = TruncateSize %> bytes.
 

The preceding script displays output similar to the following:
Log files are stored in %SystemRoot%\System32\LogFiles (D:\WINNT\System32\LogFiles) and are truncated at 20480000 bytes.
 

Applies To

Registry Access Component

See Also

Set, GetExpand